package com.guigu.pd.auth.controller;

import java.util.Arrays;
import java.util.Map;


import com.guigu.pd.auth.entity.PageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.guigu.pd.auth.entity.CoreStationEntity;
import com.guigu.pd.auth.service.CoreStationService;
import com.guigu.common.utils.PageUtils;
import com.guigu.common.utils.R;



/**
 * 岗位
 *
 * @author deyran
 * @email deyran@gmail.com
 * @date 2022-07-19 19:05:57
 */
@RestController
@RequestMapping("auth/corestation")
public class CoreStationController {
    @Autowired
    private CoreStationService coreStationService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("auth:corestation:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = coreStationService.queryPage(params);

        return R.ok().put("page", page);
    }
    @PostMapping(value = "coreStationEntity.action/{pagecurrent}/{pagesize}")
    public PageVo<CoreStationEntity> coreStationEntitylist(@RequestBody CoreStationEntity coreStationEntity, @PathVariable int pagecurrent, @PathVariable int pagesize){

        PageVo<CoreStationEntity> querycoreStation = coreStationService.queryCoreStationEntity(coreStationEntity, pagecurrent, pagesize);
        return querycoreStation;
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("auth:corestation:info")
    public R info(@PathVariable("id") Long id){
		CoreStationEntity coreStation = coreStationService.getById(id);

        return R.ok().put("coreStation", coreStation);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("auth:corestation:save")
    public R save(@RequestBody CoreStationEntity coreStation){
		coreStationService.save(coreStation);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("auth:corestation:update")
    public R update(@RequestBody CoreStationEntity coreStation){
		coreStationService.updateById(coreStation);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("auth:corestation:delete")
    public R delete(@RequestBody Long[] ids){
		coreStationService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
